﻿using System;
using System.Collections.Generic;
using Dsl.Ped.Framework.Common;

namespace Dsl.Ped.Framework.Projectives 
{
    /// <summary>
    /// This is the "artificial" object that is <see cref="IProjective"/>.
    /// This can be build above a collection or etc. which can not be 
    /// directly enhanced to a <see cref="IProjective"/>
    /// </summary>
    public class ObjectProjective : ProjectiveBase, IProjective
    {
        #region Fields

        private List<IProjectionContainer> projectionContainers;

        private Dictionary<string, IProjection> projectiveEvents;

        #endregion

        #region Constructor

        public ObjectProjective(string name, IProjection projection)
        {
            this.projectionContainers = new List<IProjectionContainer>();
            this.projectionContainers.Add(new ProjectionContainer(name, projection));

            projectiveEvents = new Dictionary<string, IProjection>();
        }

        public ObjectProjective(IProjectionContainer projectionsContainer)
        {
            this.projectionContainers = new List<IProjectionContainer>();
            this.projectionContainers.Add(projectionsContainer);
        }

        public ObjectProjective(List<IProjectionContainer> projectionContainers)
        {
            this.projectionContainers = projectionContainers;
        }

        public ObjectProjective(Func<List<IProjectionContainer>> func)
        {
            this.projectionContainers = func();
        }

        #endregion

        #region Methods

        public override List<IProjectionContainer> GetProjectionContainers()
        {
            return this.projectionContainers;            
        }

        #endregion

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    }
}
